/**      
 * @file		functionArrayParam.cpp
 * @description	Demonstrates the use of sending a whole
 *				array as a parameter to a function. This
 *				doesn't pass the array by value. It passes by
 *				reference even though the & isn't used.
 *				We can modify the elements of the array.
 * @course		CSCI 123 Section 00000
 * @assignment 
 * @date		mm/dd/yyyy
 * @author		Brad Rippe (00000000) brippe@fullcoll.edu
 * @version		3.0
 */
#include <iostream>
#include <cctype>
using namespace std;

const int NUMBER_OF_GRADES = 3;

/**
 * Gets the grades from the user
 * @pre		the grades have been initialized
 * @post	the grade values have been set by the user  
 * @param	grades the list to store the grades
 */
void getGrades(char aGrades[]);

/**
* Displays the grades to standard output
* @pre		all the grade values have been set
* @post		the grades have been display (using standard output)
*		to the user
* @param	grades the list of grades to display to the user
*/
void displayGrades(const char aGrades[]);

/**
 * @return zero if the application executes successfully
 */
int main() {
	// declares the array
	char grades[NUMBER_OF_GRADES];

	cout << "Please type in five grades (A,B,C,D, or F)\n";
	getGrades(grades);
	cout << "You typed\n";
	displayGrades(grades);

	return 0;
}

void getGrades(char aGrades[]) {
	for(int i = 0; i < NUMBER_OF_GRADES; i++) {
		cout << "Grade " << (i+1) << ": ";
		cin >> aGrades[i];
	}
}

void displayGrades(const char aGrades[]) {
	for(int i = 0; i < NUMBER_OF_GRADES; i++) {
		cout << "Grade " << (i+1) << " = " 
		     << static_cast<char>(toupper(aGrades[i])) << endl;
	}
}

